<template>
  <div>
    <ul>
      <li v-for="m in messageList" :key="m.id">
        <router-link active-class="active" :to="{
          name:'Detail',
          query:{
            id:m.id,
            title:m.title
          }
        }">{{ m.title }}
        </router-link>
        <button @click="pushShow(m)">push查看</button>
        <button @click="replaceShow(m)">replace查看</button>
      </li>
    </ul>
    <hr>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "Message",
  data() {
    return {
      messageList: [
        {id: '0001', title: 'message001'},
        {id: '0002', title: 'message002'},
        {id: '0003', title: 'message003'},
      ]
    }
  },
  props: [],
  computed: {},
  components: {},
  methods: {
    pushShow(m) {
      this.$router.push({
        name: 'Detail',
        query: {
          id: m.id,
          title: m.title
        }
      });
    },
    replaceShow(m) {
      this.$router.replace({
          name: 'Detail',
          query: {
            id: m.id,
            title: m.title
          }
      });
    },
  },
  mixins: [],
  watch: {},
  filters: {},
  directives: {}
}
</script>

<style scoped>

</style>